Improve SwiftData repo init and controller input handling - #4
Merged
Conversation
Add configurable SwiftData repository store path and robust initialization: SwiftDataLibraryRepository gains makeModelContainer to create parent directories, handle unreadable/incompatible on-disk stores by removing sqlite artifacts (-shm/-wal) and retrying, and helper methods to ensure directories. LibraryHydrationWorker and LibraryController now accept/produce an explicit repository store URL. MetadataCacheStore.cacheURL ensures cache directories exist. LibraryPersistenceCoordinator clears legacy swiftdata artifacts when wiping caches. Refactor input plumbing to use StreamingSessionFacade: StreamRuntimeAttachmentService and StreamController pass the session instead of an InputQueue, and InputController now accepts a session, reports gamepad connection state via a session callback, and runs a MainActor polling task to enqueue gamepad frames continuously (with idle/frame suppression logic). Tests updated and new SwiftDataLibraryRepository tests added for unreadable-store reset and parent directory creation.
Replace controller polling with an explicit active streaming session binding and simplify controller observation: store the active StreamingSessionFacade, use its inputQueue for injected frames, and call setGamepadConnectionState on the session instead of an external callback. Remove the controller polling loop and related enqueue logic, and enqueue idle frames in suppressing branches to avoid sending unwanted input. Add raw outbound input packet logging to InputChannel (limited emission count, hex dump and concise summary extraction) and wire the new shouldLogRawOutboundPackets hook through StreamingRuntime and tests. Also add a diagnostic log when flushing pending gamepad registration updates and make resetTransientState optionally preserve desiredGamepadConnectionState across a reconnect. Adjust SwiftData repository initialization to use a .swiftdata store URL (delete original extension and append .swiftdata) and update tests and call sites to match the parameter label change for setupControllerObservation. Minor Xcode scheme XML reorder for TestPlans. Temporary patches Co-Authored-By: nafields <2613057+nafields@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add configurable SwiftData repository store path and robust initialization: SwiftDataLibraryRepository gains makeModelContainer to create parent directories, handle unreadable/incompatible on-disk stores by removing sqlite artifacts (-shm/-wal) and retrying, and helper methods to ensure directories. LibraryHydrationWorker and LibraryController now accept/produce an explicit repository store URL. MetadataCacheStore.cacheURL ensures cache directories exist. LibraryPersistenceCoordinator clears legacy swiftdata artifacts when wiping caches. Closes #2
WIP: Refactor input plumbing to use StreamingSessionFacade: StreamRuntimeAttachmentService and StreamController pass the session instead of an InputQueue, and InputController now accepts a session, reports gamepad connection state via a session callback, and runs a MainActor polling task to enqueue gamepad frames continuously (with idle/frame suppression logic). Tests updated and new SwiftDataLibraryRepository tests added for unreadable-store reset and parent directory creation. Closes #3